﻿@model MAPDavy.Entities.Term

@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section JavaScript{
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var _cerrado = $.cookie("cerrado");

            if (_cerrado) {
                $("#save").hide();
            }

            $("#TestingStartDate").datepicker({
                changeMonth: true,
                changeYear: true,
                dateFormat: 'dd/mm/yy'
            });
            $("#TestingEndDate").datepicker({
                changeMonth: true,
                changeYear: true,
                dateFormat: 'dd/mm/yy'
            });

            $('#guardar').click(function () {
                $('form').submit();
            });
        });
    </script>
}
<div class="cpanel ui-widget ui-widget-content ui-corner-all">
    <table class="toolbar">
        <tr>
            <td valign="middle" >
                <img src="@Url.Content("~/Content/images/newTask.png")" alt="evaluaciones" />
            </td>
            <td class="tdHeader"><span class="header">Editar Evaluación</span></td>
            <td class="cerrado"><center>
                <a href="#" id="guardar">
                   <img src="@Url.Content("~/Content/images/save.png")" title="Guardar" alt="Guardar" />
                    <br /><span class="label">Guardar</span>
                </a></center>
            </td>
            <td><center>
                <a href="@Url.Action("Index", "Term")">
                    <img src="@Url.Content("~/Content/images/back.png")" title="Candelar" alt="Candelar" />
                    <br /><span class="label">Cancelar</span>
                </a></center>
            </td>
        </tr>
    </table>
</div>
@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Evaluación</legend>

        @Html.HiddenFor(model => model.Id)
        @Html.HiddenFor(model=>model.Anio)

        <div class="editor-label">
            <h3>MAP:  @Html.DisplayFor(model => model.MAP.NameMap)</h3>
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.NameTerm, "Nombre Evaluación")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.NameTerm)
            @Html.ValidationMessageFor(model => model.NameTerm)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Description)
            @Html.ValidationMessageFor(model => model.Description)
        </div>    
            
        <div class="editor-label">
            @Html.LabelFor(model => model.TestingStartDate, "Inicio de Evaluaciones")
        </div>
        <div class="editor-field">
           @Html.TextBox("TestingStartDate", (Model.TestingStartDate.HasValue ? Model.TestingStartDate.Value.ToShortDateString() : string.Empty), new { @class = "datePicker" })
            @Html.ValidationMessageFor(model => model.TestingStartDate)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.TestingEndDate, "Fin de Evaluaciones")
        </div>
        <div class="editor-field">
           @Html.TextBox("TestingEndDate", (Model.TestingEndDate.HasValue ? Model.TestingEndDate.Value.ToShortDateString() : string.Empty), new { @class = "datePicker" })
            @Html.ValidationMessageFor(model => model.TestingEndDate)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Cerrado)
            @Html.EditorFor(model => model.Cerrado)
            @Html.ValidationMessageFor(model => model.Cerrado)
        </div>
    </fieldset>
}
